package test.school.entity;

public class Student extends Person{
    private Course course;

    public Student(String id,String name,String gender){
        super(id ,name ,gender);
    }

   public void yesCourse(Course course) {
        if (course != null) {
            this.course = course;
            // 添加选课提示
            System.out.println(name + "同学已选择《" + course.getCourseName() + "》课程");
        } else {
            System.out.println("选课失败");
        }
    }

    public void noCourse() {
        if (this.course != null) {
            String courseName = this.course.getCourseName();
            this.course = null;
            // 添加退课提示
            System.out.println(name + "同学已退选《" + courseName + "》课程");
        } else {
            System.out.println(name + "同学当前没有选中的课程，无需退课");
        }
    }
    public void printWorksheet() {
        if (course != null) {
            System.out.println("=学生课表=");
            System.out.println("学生编号：" + id);
            System.out.println("课程名称：" + course.getCourseName());
            System.out.println("上课地点：" + course.getLocation());
            System.out.println("上课时间：" + course.getTime());
            System.out.println("授课教师：" + course.getTeacher().getName());
        } else {
            System.out.println("该学生未选课，课表为空。");
        }
    }

    public Course getCourse(){
        return course;
    }


}
